home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 081 / tinylist.arc / TL.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1987-07-27  |  2.2 KB  |  94 lines

  1. const
  2.   lines=140;     {This is number of lines per column.}
  3.   columns=2;     {This is number of 66 character columns.}
  4.                  {150 lines and 2 columns gives maximum density for 8.5x11
  5.                   inch paper, about 20k}
  6.  
  7.   initstring=#27'3'#15#27'S0'#15;   {This is the printer init string.  It
  8.                                      sets Superscript, 15/216 inch line
  9.                                      spacing, and compressed print.  Change
  10.                                      this string for non Epson compatible
  11.                                      printers.}
  12.  
  13.   resetstring=#27'@';
  14.  
  15. type
  16.   linetype=string[66];
  17.   pagetype=array[1..columns,1..lines] of linetype;
  18.  
  19. var
  20.   page:pagetype;
  21.   infile,outfile:text;
  22.   linesread,a,b,i,j:integer;
  23.   inname:string[20];
  24.   EndOfFile : boolean;
  25.  
  26. function rl:linetype;
  27.   var
  28.     s:linetype;
  29.     c:char;
  30.   begin
  31.     s:='';
  32.     repeat
  33.       read(infile,c);
  34.       if (c<>#13) and (c<>#10) then
  35.         s:=s+c;
  36.     until eoln(infile) or (length(s)=64);
  37.     rl:=s;
  38.   end;
  39.  
  40. function pad(s:linetype):linetype;
  41.   var
  42.     s1:linetype;
  43.   begin
  44.     s1:=s;
  45.     while length(s1)<66 do
  46.       s1:=s1+' ';
  47.     pad:=s1;
  48.   end;
  49.  
  50. begin
  51.   If Paramstr(1) = '' then
  52.   begin
  53.     write('Enter input filename:  '); readln(inname)
  54.   end
  55.   else inname := ParamStr(1);
  56.   assign(infile,inname);
  57.   reset(infile);
  58.   writeln(lst,initstring);
  59.   repeat
  60.     j:=0;
  61.     linesread:=0;
  62.     writeln('Reading....');
  63.     repeat
  64.       j:=j+1;
  65.       i:=0;
  66.       repeat
  67.         i:=i+1;
  68.         linesread:=linesread+1;
  69.         page[j,i]:=rl;
  70.         EndOfFile := Eof(infile);
  71.       until (i=lines) or EndOfFile;
  72.     until (j=columns) or (EndOfFile);
  73.     writeln(linesread);
  74.     b:=0;
  75.     if j=columns then linesread:=linesread-(lines*(j-1));
  76.     if j>1 then i:=lines;
  77.     writeln('Printing....');
  78.     repeat
  79.       b:=b+1;
  80.       a:=0;
  81.       repeat
  82.         a:=a+1;
  83.         write(lst,pad(page[a,b]));
  84.       until (a=j);
  85.       linesread:=linesread-1;
  86.       if linesread=0 then j:=j-1;
  87.       writeln(lst);
  88.     until (b=i);
  89.     Writeln(lst,#12)
  90.   until EndOfFile;
  91.   close(infile);
  92.   write(lst,resetstring)
  93. end.
  94.